package partlycloudy;

public class Cloud
{
    private Daylight daylight = new Daylight();
    private Luminary luminary = new Luminary();
    private Wind wind = new Wind();
    
    private Creature InternalCreate()
    {
        if((wind.Speed>=0)||(wind.Speed<=10))
        {
        if(daylight.Current == DaylightType.Morning)
        {
                if(luminary.IsShining())  
                {
                        if(wind.Speed < 5)
                            return new Creature(CreatureType.Kitten);
                        else if(wind.Speed < 9)
                            return new Creature(CreatureType.Puppy);
                        else
                            return new Creature(CreatureType.Piglet);
                }
                else  
                {
                        if(wind.Speed < 6)
                            return new Creature(CreatureType.Piglet);
                        else if(wind.Speed < 8)
                            return new Creature(CreatureType.Hedgehog);
                        else
                            return new Creature(CreatureType.Bearcub);
                }
        }
        else if(daylight.Current == DaylightType.Noon)
        {
                if(luminary.IsShining())  
                {
                        if(wind.Speed > 5)
                            return new Creature(CreatureType.Puppy);
                        else if (wind.Speed > 0)
                            return new Creature(CreatureType.Kitten);
                        else
                            return new Creature(CreatureType.Balloon);
                }
                else  
                {
                        if(wind.Speed > 7)
                            return new Creature(CreatureType.Bearcub);
                        else
                            return new Creature(CreatureType.Hedgehog);
                }
        }
        else if(daylight.Current == DaylightType.Evening)
        {
                if(luminary.IsShining())  
                {
                        if(wind.Speed < 6)
                            return new Creature(CreatureType.Piglet);
                        else if(wind.Speed < 8)
                            return new Creature(CreatureType.Hedgehog);
                        else
                            return new Creature(CreatureType.Bearcub);
                }
                else  
                {
                        if(wind.Speed < 4)
                            return new Creature(CreatureType.Kitten);
                        else if(wind.Speed < 8)
                            return new Creature(CreatureType.Puppy);
                        else
                            return new Creature(CreatureType.Bat);
                }
        }
        else if(daylight.Current == DaylightType.Night)
        {
                if(luminary.IsShining())
                {
                        return new Creature(CreatureType.Kitten);
                }
                else 
                {
                        if(wind.Speed != 10)
                            return new Creature(CreatureType.Bat);
                        else
                            return new Creature(CreatureType.Balloon);
                }
        }
        }
        throw new java.lang.UnsupportedOperationException();
    }
    public Creature Create()
    {
      Creature creature = InternalCreate();
      Magic magic = new Magic();
      switch (creature.CreatureType)
      {
          case Puppy:
          case Kitten:
          case Piglet:
          case Balloon:
              magic.CallStork(creature.CreatureType);
              break;
          case Bat:
          case Bearcub:
          case Hedgehog:
              magic.CallDemon(creature.CreatureType);
              break;
      }
      return creature;
    }
}


class Daylight 
{
    public DaylightType Current;
}


class Luminary 
{
    public boolean Shine;
    
    public boolean IsShining()
    {
        return Shine;
    }
}


class Wind 
{
    public int Speed;
}